#include <bits/stdc++.h>
using namespace std;
#define int long long
int T,a[1000100],flag[1000100],n;
int l_max(int x){
    for(int i=x-1;i>=1;i--){
        if(flag[i]==flag[x]){
            if(a[i]==a[x])return a[x];
            else return 0;
        }
    }
    return 0;
}
void dfs(int step){
    step++;
    if(step==n){
        int c;
        for(int i=1;i<=n;i++){
            c+=l_max(i);
        }
        maxn=max(maxn,c);
    }
    else {
        dfs(step+1);
        flag[step]=1;
        dfs(flag+1);
    }
}
signed main(){
    //freopen("color.in","r",stdin);
    //freopen("color.out","w",stdout);
    cin >> T;
    while(T--){
        memset(flag,0,sizeof(flag));
        maxn=-1;
        int maxn=-1,ans,box[1000100],t=-1;
        cin >> n;
        dfs(0);
        cout << maxn << endl;
    }
    return 0;
}
